<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>分销商列表</title>
<%@include file="../header.jsp" %>
<script type="text/javascript" src="/js/area-select.js"></script>
<script type="text/javascript">
	function queryDistributors() {
		$("#distributor-table").load("/distributor/table.htm", {
			name:$("#distributor-query-form").find("input[name='name']").val(),
			admDivId:$("#distributor-query-form").find("select[name='areaId']").val()
		})
	}
	
	function addDistributor() {
		window.location = "/distributor/add.htm";
	}
	
	function deleteDistributor() {
		if(window.confirm("确定删除？")) {
			var checkIds = $("#distributor-table").find("input[name='distributorId']:checked").map(function() {
				return $(this).val();
			}).get().join(",");
			$.ajax({
				url:"/distributor/delete.htm",
				type:"post",
				data:"distributorIds="+checkIds,
				dataType:"json"
			}).done(function(data){
				alert(data.msg);
				if(data.isSuccess)
					window.location = window.location;
			})
		}
	}
</script>
</head>
<body>
	<div class="ch-container">
		<div class="row">
			<div class="box col-md-12">
		        <div class="box-inner">
		            <div class="box-header well" data-original-title="">
		                <h2><i class="glyphicon glyphicon-edit"></i> 查询条件</h2>
		
		                <div class="box-icon">
		                    <a href="javascript:;" class="btn btn-setting btn-round btn-default"><i
		                            class="glyphicon glyphicon-cog"></i></a>
		                    <a href="javascript:;" class="btn btn-minimize btn-round btn-default"><i
		                            class="glyphicon glyphicon-chevron-up"></i></a>
		                    <a href="javascript:;" class="btn btn-close btn-round btn-default"><i
		                            class="glyphicon glyphicon-remove"></i></a>
		                </div>
		            </div>
		            <div class="box-content">
		                <form class="form-inline" id="distributor-query-form">
		                    <div class="form-group col-md-6">
		                        <label>分销商名称：</label>
		                        <input name="name" type="text" class="form-control">
		                    </div>
		                    <div class="form-group col-md-6">
		                        <label>所属地区：</label>
		                        <select class="area-select form-control">
		                        	<option value="">--请选择--</option>
		                        	<c:forEach items="${provinces }" var="province">
		                        		<option value="${province.admDivId }">${province.name }</option>
		                        	</c:forEach>
		                        </select>
		                        <select class="area-select form-control">
		                        	<option value="">--请选择--</option>
		                        </select>
		                        <select class="area-select form-control" name="areaId">
		                        	<option value="">--请选择--</option>
		                        </select>
		                    </div>
		                    <div class="clearfix"></div><br>
		                    <div class="form-group col-md-5">
		                    	<a href="javascript:;" class="btn btn-default" onclick="queryDistributors();">查询</a>
		                    </div>
		                    <div class="clearfix"></div><br>
		                </form>
		            </div>
		        </div>
		    </div>
		    <!--/span-->
		</div>
		<div class="row">
			<div class="box col-md-12">
    			<div class="box-inner">
    				<div class="box-header well" data-original-title="">
        				<h2><i class="glyphicon glyphicon-user"></i> 票品列表</h2>

        				<div class="box-icon">
				            <a href="#" class="btn btn-setting btn-round btn-default"><i class="glyphicon glyphicon-cog"></i></a>
				            <a href="#" class="btn btn-minimize btn-round btn-default"><i
				                    class="glyphicon glyphicon-chevron-up"></i></a>
				            <a href="#" class="btn btn-close btn-round btn-default"><i class="glyphicon glyphicon-remove"></i></a>
				        </div>
    				</div>
    				<div class="box-content" id="distributor-table">
		    			<jsp:include page="table.jsp"/>
				    </div>
    			</div>
    		</div>
    <!--/span-->
		</div>
	</div>
</body>
</html>